<template>
    <div class="prescription-detail">
        <div class="title">处方详情
          <spen @click="back">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
            返回上一页</spen>
        </div>
        <div class="card flex-1">
            <DetailInfo :dataList="dataInfo.detail" />
            <div class="table">
                <el-table  :data="tableData" style="width: 100%">
                  <el-table-column label="费用名字" align="center" prop="medicGeneralName" />
                  <el-table-column label="规格" align="center" prop="medicSpec" />
                  <el-table-column label="剂型" align="center" prop="medicType"/>
					  <el-table-column label="单次剂量" align="center" prop="medicUsedosage"/>
					  <el-table-column label="天数" align="center" prop="medicDays"/>
					  <el-table-column label="价格" align="center" prop="price"/>	
				</el-table>
				</div>
            <div class="total">药品总金额：<span>{{ dataInfo.total }}</span></div>
        </div>
    </div>
</template>
<script>
import DetailInfo from '@/components/detail-info/index.vue'
import DetailTable from '@/components/detail-table/index.vue'
import { listPre, selectVisit } from "@/api/system/nation";
export default {
    name: 'PrescriptionDetail',
    components: {
        DetailInfo,
        DetailTable
    },
    data() {
		
        return {
			tableData: {
				medicGeneralName: '',
				medicSpec: '',
				medicType: '',
				medicUsedosage: '',
				medicDays: '',
				price: ''
			},
            dataInfo: {
                detail: [
					
                ],
                total: 0
            },
            tableConfig: [
                {
                    field: 'name',
                    title: '药品名称',
                },
                {
                    field: 'spec',
                    title: '规格medicSpec',
                },
                {
                    field: 'type',
                    title: '剂型medicType',
                },
                {
                    field: 'usedosag',
                    title: '单次剂量medicUsedosag',
                },
                {
                    field: 'days',
                    title: '日数medicDays',
                },
                {
                    field: 'quantity',
                    title: '数量medicQuantity+medicUnit',
                },
                {
                    field: 'price',
                    title: '价格price',
                }
            ],
           
            warningTableConfig: [
                {
                    field: 'order',
                    title: '序号',
                },
                {
                    field: 'rule',
                    title: '预警规则',
                },
                {
                    field: 'content',
                    title: '预警内容',
                },
            ],
            warningTableData: [
                {
                    order: 1,
                    rule: '抗菌药物处方权规则',
                    content: '“吴俊“的抗菌药物处方权为“无抗菌药物权限”'
                },
                {
                    order: 2,
                    rule: '药品/项目名称药物规则',
                    content: '(4+7国基)头孢呋辛酯片”为非限制使用级抗菌药物'
                }
            ]
        }
    },
  created() {
    let number=this.$route.params.number.clinic_id
    let pre_id=this.$route.params.number.pre_id
    let pre_time=this.$route.params.number.pre_time
    this.getList(number,pre_id,pre_time);
  },
  methods: {
    getList(row,pre_id,pre_time) {
      selectVisit(row).then(response => {
        console.log(response.data)
        let patientSex= ''
        if(response.data.patientSex == 1 ){
          patientSex = '男'
        } else {
          patientSex = '女'
        }
        let medicalType= ''
        if(response.data.medicalType == 0 ){
          medicalType = '普通门诊'
        } else if(response.data.medicalType == 1 ){
          medicalType = '专家门诊'
        } else if(response.data.medicalType == 2 ){
          medicalType = '急诊'
        }
		this.tableData=response.data.medicines
        this.dataInfo.detail = [
          {
            label: '就诊流水号',
            value: response.data.clinic_id
          },
          {
            label: '就诊日期',
            value: response.data.clinicTime
          },
          {
            label: '处方流水号',
            value: pre_id
          },
          {
            label: '处方日期',
            value: pre_time
          },
          {
            label: '医院',
            value: this.$route.params.number.hospitalName
          },
          {
            label: '就诊科室',
            value: response.data.departmentName
          },
          // {
          //   label: '诊历',
          //   value: response.data.regionname
          // },
          {
            label: '就诊类型',
            value: medicalType
          },
          {
            label: '医生姓名',
            value: response.data.doctorName
          },
          {
            label: '医生编号',
            value: response.data.doctorCode
          },
          {
            label: '医生身份证号',
            value: response.data.idCard
          },
          {
            label: '患者姓名',
            value: response.data.patientName
          },
          {
            label: '患者性别',
            value: patientSex
          },
          {
            label: '患者年龄',
            value: response.data.patientAge
          },
          {
            label: '主诉内容',
            value: response.data.diagnosisName
          },
          {
            label: '疾病名称',
            value: response.data.chiefComplaint
          },
        ],
        this.dataInfo.total=response.data.totalPrice


      });
    },
    back() {
      this.$router.go(-1); // 返回上一页
    },
    close() {
      this.$emit('close');
      this.visible = false;
    },
    add(scope) {
      this.visible = true;
      console.log("11111111",scope)
    }
  }
}
</script>
<style scoped lang="scss">
.prescription-detail {
    height: 100%;
    display: flex;
    flex-direction: column;

    .title {
        margin-top: 10px;
        font-weight: bold;
        font-size: 26px;
        line-height: 26px;
        color: #4B4B4B;
    }

    .detail-table {
        margin-top: 13px;
    }

    .total {
        margin-top: 29px;
        font-weight: 500;
        font-size: 16px;
        color: #8B8B8B;

        span {
            color: #4B4B4B;
        }
    }
}
.card {
    background-color: #fff;
    padding: 5px 13px 19px;
    margin-top: 14px;
}
.flex-1 {
    flex: 1;
}
</style>
